package com.flyou.ccnucenter.ui.activity.gallery;

import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.flyou.ccnucenter.R;
import com.flyou.ccnucenter.adapter.LostFoundDetialGalleryAdapter;
import com.flyou.ccnucenter.ui.activity.BaseActivity1;
import com.flyou.ccnucenter.view.jazzyviewpager.JazzyViewPager;

import java.util.ArrayList;

public class LostFoundDetialGalleryActivity extends BaseActivity1 implements View.OnClickListener, ViewPager.OnPageChangeListener {

    private JazzyViewPager jazzy_pager;
    private TextView title;
    private RelativeLayout RlBack;

    @Override
    protected void initView() {
        setContentView(R.layout.activity_bbsdetial_gallery);
        RlBack = (RelativeLayout) findViewById(R.id.titlebar_rl_back);
        title = (TextView) findViewById(R.id.titlebar_tv_title);
        jazzy_pager = (JazzyViewPager) findViewById(R.id.jazzy_pager);


    }

    @Override
    protected void initDate() {
        int position = getIntent().getIntExtra("position", 0);
        ArrayList<String> photolist = getIntent().getStringArrayListExtra("photolist");
        LostFoundDetialGalleryAdapter lostFoundDetialGalleryAdapter = new LostFoundDetialGalleryAdapter(LostFoundDetialGalleryActivity.this, photolist);
        jazzy_pager.setTransitionEffect(JazzyViewPager.TransitionEffect.Accordion);
        jazzy_pager.setAdapter(lostFoundDetialGalleryAdapter);
        jazzy_pager.setCurrentItem(position);
        jazzy_pager.setOnPageChangeListener(this);
    }

    @Override
    protected void setListener() {
        RlBack.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.titlebar_rl_back:
                finish();
                break;
        }

    }

    @Override
    public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        ArrayList<String> photolist = getIntent().getStringArrayListExtra("photolist");
        title.setText((position + 1) + "/" + photolist.size());
    }

    @Override
    public void onPageSelected(int position) {

    }

    @Override
    public void onPageScrollStateChanged(int state) {

    }
}
